<?php

ini_set('display_errors', 1);
error_reporting(-1);
require_once '/data/wwwroot/g_vendor/autoload.php';

use EasyWeChat\Factory;

$config = [
    'app_id' => 'wx65c35294aee7e410',
    'secret' => 'fab6bca6ff91ae5a72a5da0c2fd6d22a'
];
$app = Factory::miniProgram($config);

$goodsIds = [
    621214
];

foreach ($goodsIds as $goodsId) {
    $response = $app->app_code->getUnlimit('goods_id=' . $goodsId, [
        'page' => 'pages/detail/detail'
    ]);
    if ($response instanceof \EasyWeChat\Kernel\Http\StreamResponse) {
        $filename = $response->saveAs('./', $goodsId . '.png');
    }
}

//$response = $app->app_code->getUnlimit('room_id=24', [
//    'page' => 'pages/spaceDetail/spaceDetail'
//]);
//if ($response instanceof \EasyWeChat\Kernel\Http\StreamResponse) {
//    $filename = $response->saveAs('./', '24.png');
//}

/*$response = $app->app_code->getUnlimit('goods_id=620823', [
    'page' => 'pages/detail/detail'
]);
if ($response instanceof \EasyWeChat\Kernel\Http\StreamResponse) {
    $filename = $response->saveAs('./', '620823.png');
}*/